package com.thy.controller;


import com.hospital.common.base.PageResult;
import com.hospital.common.base.Result;
import com.hospital.common.base.ThreadAttributes;
import com.hospital.common.dto.audit.module.ReportDto;
import com.hospital.common.utils.ThreadLocalUtils;
import com.hospital.common.vo.audit.module.ReportVo;
import com.thy.service.TReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 举报记录表
 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-09-26
 */
@RestController
@RequestMapping("/report")
public class TReportController {
    @Autowired
    private TReportService reportService;

    /**
     * 获取所有举报记录
     * @param pageNum
     * @param pageSize
     * @return
     */
    @GetMapping("/getReport")
    public Result<PageResult<ReportVo>> getReport(@RequestParam("pageNum")Integer pageNum, @RequestParam("pageSize")Integer pageSize){
       ThreadAttributes threadAttributes = ThreadLocalUtils.get();
        Long userId = threadAttributes.getUserId();
        PageResult<ReportVo> pageResult = reportService.getReport(pageNum, pageSize, userId);
        return Result.success(pageResult);
    }

    /**
     * 举报审核
     * @param reportDto
     * @return String
     */
    @PostMapping("/reviewReport")
    public Result<String> reviewReport(@RequestBody ReportDto reportDto){
        reportService.reviewReport(reportDto);
        return Result.success(1,"审核成功");
    }

}
